package demo;

import java.util.Arrays;

/**
 * 数组中最大的第K个数字
 */
class Solution4 {
	public int findKthLargest(int[] nums, int k) {
		if (k > nums.length -1) {
			return -1;
		}
		Arrays.sort(nums);
		return nums[k -1];
	}
	public static void main(String[] args) {
		Solution4 kthLargestNumberInArray = new Solution4();
		int[] nums = new int []{2,3,1,7,9,5,6};
		System.out.println(kthLargestNumberInArray.findKthLargest(nums, 4));
	}
}

